<?php
/**
 * page-footer.php, template footer
 * 
 * include by index.php
 *  
 * ================================================================
 * @package     msys-file-manager
 * @category    category
 * ================================================================
 * 
 * @author      Hamdiya <hamdiya.dev@gmail.com>
 * @copyright   Copyright (c) 2009, Hamdiya
 * @license     http://www.gnu.org/licenses/gpl.html GNU General Public License 2
 * @link        http://dir-list.sourceforge.net/
 * 
 * @author      nhnoah <nhnoah+msys@gmail.com> 
 * @copyright   Copyright (c) 2011, Nuar H. Noah (nhnoah) 
 * @license     http://www.gnu.org/licenses/lgpl.html GNU Lesser GPL
 * @link        http://msys-file-manager.googlecode.com/
 * 
 * ================================================================
 * SVN revision information:
 * 
 * @version $Revision: 24 $:
 * @author  $Author: nhnoah $:
 * @date    $Date: 2011-11-22 10:36:17 +0000 (Tue, 22 Nov 2011) $:
 * ================================================================
 * 
 * @since   0.3.1 (Date: 2011-11-21 23:07:02 +0800 (Mon, 21 Nov 2011)
 */
?>
<!-- footer  -->
<div style="width:<?php echo $table_width; ?>px; text-align:center">
<a href="http://msys-file-manager.googlecode.com/" target="_blank">Msys File Manager</a> based on 
<a href="http://dir-list.sourceforge.net/" target="_blank">dirLIST - PHP Directory Lister v0.3.0</a>
</div>
<?php if($_SESSION['logged_in']) { ?>

<div id="file_edit_box" onmouseout="mouse_out_handler(event);">
  <table width="100%" border="0" class="table_border" height="75">
    <tr>
    <td align="center" class="file_bg2" onclick="ren();" style="cursor:pointer"><img src="matrix-sys/edit_files/rename.png" alt="rename" name="rename" width="32" height="32" id="rename" style="cursor:pointer" /></td>
    <td align="center" class="file_bg2" onclick="delete_item();" style="cursor:pointer">
      <p><img src="matrix-sys/edit_files/delete.png" alt="delete" name="detele" width="32" height="32" border="0" id="detele"/></p></td>
    </tr>
  </table>
</div>
<script type="text/javascript">
var js_files_and_folders_base64 = [
	[<?PHP     
    $folders_string_base64 ='';
	 foreach($folders_sorted as $key => $val)
	 	$folders_string_base64 .= '\''.base64_encode($folders['name'][$key]).'\',';
	echo substr($folders_string_base64, 0, -1);
	 ?>],
	[<?PHP 
    $files_string_base64 = '';
	 foreach($files_sorted as $key => $val)
	 	$files_string_base64 .= '\''.base64_encode($files['name'][$key]).'\',';
	echo substr($files_string_base64, 0, -1);
	 ?>]
];

var js_files_and_folders = [
	[<?PHP 
    $folders_string = '';
	 foreach($folders_sorted as $key => $val)
	 	$folders_string .= '\''.$folders['name'][$key].'\',';
	echo substr($folders_string, 0, -1);
	 ?>],
	[<?PHP 
    $files_string = '';
	 foreach($files_sorted as $key => $val)
	 	$files_string .= '\''.$files['name'][$key].'\',';
	echo substr($files_string, 0, -1);
	 ?>]
];

function delete_item()
{
	item_name = js_files_and_folders[selected_item_type][selected_item_id];
	item_name_base64 = js_files_and_folders_base64[selected_item_type][selected_item_id];
	if(confirm("********<?PHP echo $local_text['warning']; ?>!********\n\n<?PHP echo $local_text['no_go_back']; ?>\n\n"+'<?PHP echo $local_text['sure_to_del']; ?> ` '+item_name+' ` ?')) window.location = 'matrix-sys/edit_files/delete.php?folder=<?PHP echo $_GET['folder']; ?>&item_name='+item_name_base64;
}

function ren()
{
	item_name_base64 = js_files_and_folders_base64[selected_item_type][selected_item_id];
	window.open('matrix-sys/edit_files/rename.php?folder=<?PHP echo $_GET['folder']; ?>&item_name='+item_name_base64, null, 'scrollbars = 0, status = 1, height = 135, width = 470, resizable = 1, location = 0');
}
</script>
<?php } ?>
</body>
</html>